#include <iostream>
using namespace std;

const int N = 100010;
int n, q;
int a[N];

bool start_check(int a, int b)
{
    return a >= b;
}

bool end_check(int a, int b)
{
    return a <= b;
}

int start_search(int x, int a[], int l, int r)
{
    while (l < r)
    {
        int mid = l + r >> 1;
        if (start_check(a[mid], x))
            r = mid;
        else
            l = mid + 1;
    }
    return l;
}

int end_saerch(int x, int a[], int l, int r)
{
    while (l < r)
    {
        int mid = l + r + 1 >> 1;
        if (end_check(a[mid], x))
            l = mid;
        else
            r = mid - 1;
    }
    return r;
}

int main()
{
    scanf("%d%d", &n, &q);
    for (int i = 0; i < n; ++i)
        scanf("%d", a + i);
    for (int i = 0; i < q; ++i)
    {
        int x;
        scanf("%d", &x);
        int j = start_search(x, a, 0, n - 1);
        if (a[j] != x)
            printf("-1 -1\n");
        else
            printf("%d %d\n", j, end_saerch(x, a, 0, n - 1));
    }
    return 0;
}